<?php
class {controller}Controller extends BaseController {
	
	public function indexAction($requestData) {
		$this->data['{object-collection}'] = {model}::findAll();
	}
	
	public function editAction($requestData) {
		if(@$requestData['arg0'] != '') {
			$this->data['{object-single}'] = {model}::find($requestData['arg0']);
		}else {
			$this->data['{object-single}'] = new {model}();
		}
	}
	
	public function saveAction($requestData) {
		${object-single} = $this->getModel($requestData, '{object-single}', '{model}');
		if(${object-single}->isValid()) {
			${object-single}->save();
			Adroit::$alerts->addAlert('{model} has been saved', AdroitAlertHandler::$TYPE_SUCCESS);
			self::redirect('{controller-route}', 'edit/' . ${object-single}->id);
		}else {
			$this->addValidationErrors(${object-single}, '{object-single}');
			$this->data['{object-single}'] = ${object-single};
			self::forward('{controller-route}', 'edit');
		}
	}
	
	public function deleteAction($requestData) {
		if(@$requestData['id'] != '') {
			{model}::find($requestData['id'])->delete();
			Adroit::$alerts->addAlert('{model} deleted', AdroitAlertHandler::$TYPE_SUCCESS);
		}
		self::redirect('{controller-route}/');
	}
}
?>